home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
apps
/
630
/
gemgs.doc
next >
Wrap
Text File
|
1992-09-05
|
17KB
|
410 lines
Documentation for gemGS 1.2. 7/31/92
GemGS may be freely copied and distributed, although the source is
copyrighted. Portions of the source were taken from the Unix
Ghostview distribution, and Tim Theisen holds the copyright to those
parts. If you modify the source, please change the name of the
program so that there is no confusion.
INTRODUCTION:
GemGS is a GEM shell for Ghostscript on Atari ST/TT computers. It is
far too large, and has far too many features, since I used it as an
exercise to learn some aspects of GEM programming. It is, however,
fun to play with, and may be useful to those who hate command line
interpreters. The only real advantage that the shell offers over the
command line interface is the ability to choose specific pages from
large documents for GS to display. Unfortunately the speed (slow) of
the page selection code nearly negates any benefit (hey, I didn't
write that part of the code).
In essence, gemGS simply sets up a GS environment, allows the user to
pick Ghostscript options with the mouse, and then executes GS.
Some frills are:
1) Setup file that allows the user to define menu items, select
default options, and define environment variables.
2) A user definable "tool" menu, which can be loaded with all kinds
of gem, tos, and ttp utility programs, which can then be run from
the shell in a semi-integrated fashion.
3) GemGS can be installed so that it automatically displays PostScript
files which have been double-clicked.
Disadvantages are:
1) It is tedious to use if you like CLIs.
2) Postscript document scanning for page selection is sloooow. I
stole most of the code for this from the Ghostview (X Windows shell
for GS) distribution, so I will pass the blame until I get time
to look into speeding it up.
3) The menu bar and the command line dialog are too large for low
resolution on the ST. You can sort of use gemGS, but not too well.
I may fix up a low res version sometime in the future.
BASIC USAGE:
From a command line: gemgs [infile1 infile2 ...]
GemGS initializes the background and mouse itself, so it should work
properly when run from a shell .... except, for some reason I have
not yet discovered, it is sometimes necessary to type 'mson' before
running gemGS from gulam. GemGS does not restore the cursor when it
exits (that would mess up desktop users), so if you run from a shell,
you may end up without a visible cursor in the end unless you execute
gem programs from within some kind of wrapper.
Once inside the gemGS, you:
1) pick the input and output files from the File menu,
2) choose the device from the Device menu,
3) pick the resolution from the Resolution menu,
4) pick any options from the options menu,
5) click Run under the File menu.
Everything in items 1-4, except for choosing the input file, can be
done from the startup file. The input file can be entered on the
command line. If you do both of these, all you need to do from inside
the shell is 5.
Depending on how the options are set, selecting the Run menu item will
either start GS running, or you will get an editable dialog showing the
command line that will be passed to GS and asking for confirmation.
After this, you interact with GS as usual; see the GS documentation.
When GS exits, you will return to the shell.
GemGS can also be installed on the desktop to automatically display
PostScript files which have been double-clicked. To do this, use
whatever procedure is necessary on your machine to install gemGS
as the default application for files with extension .ps. Then make
sure the line "autorun 1" is in the the gemgs.rc startup file. When
gemGS has been given command line parameters, autorun tells it
to execute GS immediately on the input files, disregarding the
state of the "confirm" option. If there are no input files, gemGS
enters interactive mode as usual.
NOTE: GemGS looks searches the PATH environment variable for the
file 'gs.ttp'. If PATH is not set, or you changed the name of
the ghostscript executable, you will get a dialog stating that
GS could not be run.
The screen driver for GS has been modified to include support for
windows. This modification was intended for use with gemGS, but can
be used with GS alone. GS figures out how to handle the windows by
looking at the environment variable GS_WIN. If GS_WIN is not set, the
GS screen driver uses no windows. If GS_WIN=interact (lower case),
then images are displayed in a window, but text mode is entered after
every page. This allows interactive entry of commands at the GS
command line. "Interact" mode is intended to be used when GS is run
from a shell. If GS_WIN=batch, the screen driver assumes that you are
running GS in such a fashion that no real interaction with GS takes
place, i.e., GS prints no messages to you, and you type no commands to
it. This is the mode that gemGS uses when the "windows" option is
selected. This hides the fact that GS is really a command-line driven
program, but it is not flawless. For example, if an error occurs in
GS when GS_WIN=batch, the error message will be written all over the
screen background, menus, etc. As long as nothing abnormal happens,
it works OK. See the Atari-specific GS documentation for instructions
on screen driver use. Of course, if you have an old version of GS,
the GS_WIN variable will be ignored.
In GS 2.41 Atari revision 1, the screen driver redraws the screen
background when windows are enabled. Unfortunately, on color systems,
it uses the wrong color. This will be fixed in GS > 2.5.
MENUS:
Some menu items have alternate key bindings. Those that do, have the
binding shown beside the menu entry.
#--------------------------------------------------------------------
Desk:
About gemGS - Displays a dialog about gemGS. For those serious-minded
folks who are uncertain, this dialog is a simultaneous
commentary on the current job situation for theoretical
physicists and the complaints of shareware authors who
feel that users never pay the requested fee. In short
it is a joke. Do you think anyone will pay up?
#--------------------------------------------------------------------
File:
Run - Run Ghostscript with the current command parameters. If the
ALT-r "confirm" option is chosen, a dialog will display with the
GS command line.
Input - Presents a file selector so that the input file can be chosen.
ALT-i Note that only one file can be entered in this fashion.
Multiple input files have to be entered from a command line
or typed in the editable field which is displayed when the
"confirm" option is set.
Output- Presents a dialog for selecting output to PRN: (the centronics)
ALT-o port), CEN: (like PRN: only faster--only works on regular STs,
i.e. not STes or TTs), or to a file. If a file is desired, a
file selector is presented.
Quit - Self explanatory, I hope.
ALT-q
#--------------------------------------------------------------------
Device:
This menu item contains 2 standard entries and up to 8 more user-defined
entries. The 2 standard entries are described here.
stvdi - Selects the screen device as the GS output device.
GemGS assumes that the screen device is the default device.
Other devices can be loaded into this menu, and the default
device can be selected in the startup file. More on this later.
Other - Presents a dialog for you to type in a device which has not
been loaded into the menu.
#--------------------------------------------------------------------
Resolution:
This menu item contains 2 standard entries and up to 8 more user-defined
entries. The 2 standard entries are described here.
Default - Use the default resolution of the selected device.
Other - Presents a dialog for you to type in a resolution which has
not been loaded into the menu. It is up to the user to use
resolutions that the chosen device can handle.
#--------------------------------------------------------------------
Options:
All of the following options can be set from the gemGS startup file.
Confirm - Display a dialog containing the GS command line and ask
for confirmation before running GS. The command line can
be edited at this time.
Quiet - Run GS in quiet mode, no startup/informative messages.
NoPause - Tells GS not to pause and the end of every page in a
multi-page document. If NoPause is turned off, you have
to hit RETURN at the end of every page.
AutoQuit - GS will quit when it runs out of input. By default, GS
enters interactive mode when it reaches the end of its
input files.
Windows - This tells GS to display the image in a window. It is
only enabled when the screen device is selected. It is
ignored for printer devices. When this option is selected,
the environment variable GS_WIN is defined with the value
"batch". Selecting "windows" will automatically select
the "quiet", "nopause", and "autoquit" options. This is
so that output from GS does not get written all over the
GEM screen. Unfortunately, however, any GS error messages
will be ugly. Note that old versions of GS (generally < 2.5,
although some versions of 2.41 are OK) cannot display in
windows, and will ignore the GS_WIN envorinment variable.
Geometry - Display a dialog that allows a geometry to be chosen.
The Geometry is just the size of the image in pixels,
like 640x400. Every device has a default geometry, but
you can change it if you like.
Clist - Print images in bands for machines with limited memory.
GS can print imaging commands to a "Command list" and
then read these commands back repeatedly to construct large
images in bands. This is MANDATORY on 1M machines. When "Clist"
is selected, a dialog is presented to allow the user to
enter the size of the buffer (in bytes) that will be used
to hold the bands. Entering 100000 means that the image will
be printed in chunks of 100K bytes each. You will need to
have 100K of free memory AFTER GS is loaded and has allocated
memory for needs other than the print buffer.
Pages - If no input file is selected, a file selector is presented.
The input file is then scanned to determine the number of
pages and their order, etc. This can take a very long time
for long documents (about 5 minutes for 30 pages). A dialog
is then presented so that the desired pages can be selected.
Pages are selected by EITHER clicking on the appropriate
boxes OR typing a string in the editable text field provided.
The contents of the editable field override the buttons. The
buttons are used only if the field is empty. The Clear button
in this dialog clears all button selections AND the editable
field. Use the arrows to scroll up and down if there are
more than 10 pages. The selected pages are written to a
file called "pspage.ps", and that file is automatically
passed to GS instead of the original input file. "Pspage.ps"
is deleted when gemgs exits, but is available for viewing
and editing from within gemGS (by using programs in the tool
menu).
#--------------------------------------------------------------------
Tools:
This menu contains no default entries. Everything in this menu is
loaded from the gemGS startup file. This menu is very flexible, and
is intended to provide a convenient interface to programs which are
often used on conjunction with GS. For example, one menu entry in the
example startup file runs the micro-emacs editor on the input file.
Another entry runs dvips, a program that converts TeX dvi files to
postscript format. A help entry runs micro-emacs on this
documentation file. The programs can be of GEM, TOS, or TTP type.
In the definition of a tool menu entry, there are a few keywords that
allow a limited use of dialogs and file selectors with programs in the
tools menu. See the documentation on the startup file for more
details.
STARTUP FILE:
On startup, gemGS looks for a file named "gemgs.rc". If this file
cannot be found in the current directory, then the directory contained
in the environment variable HOME is searched. An alert warns if no
startup file can be found. The syntax of the allowed commands is
documented in the example startup file which should be included in
this distribution. A copy is included here for convenience.
#--------------------------------------------------------------------
# Begin example gemgs.rc
#--------------------------------------------------------------------
#
# Example setup file for gemGS.
#
# The format for the setup commands is currently very strict, so
# pay close attention to the precise form. Never use more than
# a single space, and don't use any tabs.
#
# Any line which cannot be recognized is ignored, but I have
# conventionally used a '#' to denote a comment.
#
# Set default device. This overrides the GS_DEVICE environment
# variable. If this is missing, the default is the stvdi device.
# The device name must match name that GS knows for the device.
# To see what devices are installed, type gs -?.
# Format is "device gs_device_name".
device stvdi
# Set gemGS to autorun. When autorun is set to 1, gemGS will immediately
# run GS on the input file, ignoring the 'confirm' option if it is set.
# If there is no input file, the autorun variable is ignored and gemGS
# runs interactively. This allows PostScript files to be immediately
# displayed with gemGS by simply double-clicking on the file. Of course,
# you must install gemGS as an desktop application first.
autorun 1
# Set the default options.
# Format for on/off options is "option_name 1/0".
#confirm 1
#quiet 0
nopause 0
#autoquit 1
windows 1
# Format for other options is "option_name option_string".
#resolution 60
#geometry 400x400
#clist 150000
# Set environment variables. PATH is used in searching for GS
# and for tools. GS_DEVICE is the default device if the "device"
# command appears nowhere in this file. GS_LIB is the path that
# GS searches for ps files, fonts, etc.
setenv PATH=c:\bin,f:\gs
#setenv GS_DEVICE=deskjet
setenv GS_LIB=f:\gs,f:\gs\ps,f:\gs\fonts
# Add devices to the device menu. The device name must match the
# Ghostscript name for the device. Type 'gs -h' to see which
# devices are available in the GS executable that you have.
# Format is "devmenu gs_device_name".
devmenu deskjet
devmenu epson
devmenu paintjet
# Add resolutions to the resolution menu. The default screen
# resolution is 80dpi. All resolution entries are in dots-per-inch.
# The resolution string should be whatever comes after the GS
# -r command line switch. It is up to you to specify a resolution
# that the given device can handle.
# Format is "resmenu resolution_string".
resmenu 60
resmenu 100
resmenu 120x60
# Add tools to the tool menu. These can be GEM, TOS, or TTP programs.
# PATH will be searched for any program specified. If the program
# is not in the specified PATH environment variable, the full program
# name must be given. The following special keywords are recognized
# by gemGS as command line options for tool menu entries:
#
# infile: substitute the input file in the position of this keyword,
# outfile: substitute the output file in the position of this keyword,
# fsel: present a file selector, put the selection in this position,
# dialog: present a dialog with an editable text string, input here,
# pause: pause after tool terminates before redrawing screen,
# gem: specifies that program is a GEM program so that screen
# and mouse are handled properly.
#
# Format is "toolmenu menu_string program_name [command line options]"
toolmenu gemGS-Help ue gemgs.doc
toolmenu GS-Help ue f:\gs\doc\use.doc
toolmenu Edit-File ue dialog
toolmenu Edit-Input ue infile
toolmenu Print-Output bpr outfile
toolmenu TeXdvi-to-PS dvips fsel
toolmenu Dega-to-PS psst gem
toolmenu Shell gulam
toolmenu Directory ls -l pause
toolmenu DiskSpace df c: d: e: f: g: h: pause
#--------------------------------------------------------------------
# End example gemgs.rc
#--------------------------------------------------------------------
ACKNOWLEDGEMENTS:
The code for scanning PostScript documents and printing selected
pages to a file was taken from the source for Ghostview, by
Tim Theisen.
SUGGESTIONS, QUESTIONS, and BUG REPORTS:
Any suggestions for improving gemGS are welcome.
Questions and bug reports can be sent to:
Tim Gallivan
Center for Relativity
Department of Physics
University of Texas at Austin
Austin, TX 78712
timg@landau.ph.utexas.edu
/* EOF */